Pre-migration fix for SNPRC specimen StorageColumnName mismatches#935
Open
labkey-martyp wants to merge 6 commits into
Open
Pre-migration fix for SNPRC specimen StorageColumnName mismatches#935labkey-martyp wants to merge 6 commits into
labkey-martyp wants to merge 6 commits into
Conversation
Bumps schema version to 26.001 and registers SNPRC_EHRUpgradeCode, which verifies each PropertyDescriptor in the specimen storage schema points at an actual provisioned column and resets StorageColumnName to Name when it doesn't. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Completes the 26.000 -> 26.001 schema bump by hooking the upgrade SQL to the Java method added in 4c576ca. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Needed by SNPRC_EHRUpgradeCode for SpecimenTablesProvider. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Are you sure this issue affects SNPRC only? They're the only distribution that will receive this fix. |
The existing resolution check used TableInfo.getColumn() which is case-insensitive (CaseInsensitiveHashMap), so a StorageColumnName that differed from the physical column only in case was treated as already correct on the SQL Server source. After migration to a case-sensitive destination database those rows would still fail, defeating the purpose of the pre-migration fix. Resolve the column by StorageColumnName first; consider it correct only when row.storageColumnName().equals(byStorage.getMetaDataIdentifier().getId()). Otherwise rewrite to the physical metadata identifier of either the StorageColumnName-resolved column or, failing that, the column resolved by Name. This catches both entirely-broken StorageColumnName values and case-only mismatches. Also call OntologyManager.clearCaches() after committing the updates so any PropertyDescriptors populated into PROP_DESCRIPTOR_CACHE earlier in startup don't retain pre-update StorageColumnName values. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
labkey-bpatel
approved these changes
May 20, 2026
…fb_snprc_pg_data_migration_fixes
labkey-martyp
commented
May 21, 2026
Contributor
Author
labkey-martyp
left a comment
There was a problem hiding this comment.
We can follow up if we need to apply this fix more broadly. Running it multiple times is fine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
The SNPRC SQL Server source has
PropertyDescriptorrows in the specimenstorage schema whose
StorageColumnNamedoes not match any column on theprovisioned table. Left as-is, this prevents the SQL Server -> Postgres
migration from successfully reading/writing the specimen schema. The fix
runs as a SQL Server-only upgrade (26.000 -> 26.001) so the source is
clean before the migration is performed.
Related Pull Requests
Changes
SNPRC_EHRUpgradeCode.fixSpecimenStorageColumnNames: for eachPropertyDescriptorin the specimen storage schema, if itsStorageColumnNamedoesn't resolve on the provisioned table butNamedoes, updateStorageColumnNametoName. Skips and logs when neither name resolves or both already match.snprc_ehrschema version 26.000 -> 26.001 and register the upgrade code.snprc_ehr-26.000-26.001.sqlinvoking the Java upgrade code (no Postgres script -- runs only on the source side prior to migration).platform:studyapiJar dependency required bySNPRC_EHRUpgradeCodeforSpecimenTablesProvider.